# /usr/bin/env python3.6
# -*- encoding: utf-8 -*-
"""
@File    : models.py
@Time    : 2020/2/5 0005 16:50
@Author  : zhangbing
@Email   : 18829172841@163.com
@Software: PyCharm
"""
from App.ext import db


class BaseModel(db.Model):
    __abstract__ = True
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)

    def save(self):
        try:
            db.session.add(self)
            db.session.commit()
            return True
        except  Exception as e:
            print(e)
            return False

    def delete(self):
        try:
            db.session.delete(self)
            db.session.commit()
            return True
        except   Exception  as  e:
            print(e)
            return False


if __name__ == "__main__":
    pass
